using ExampleWebApplication.Entities;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;

namespace ExampleWebApplication.Infraestruture.NHibernate.EntityMappings
{
    public class CustomerDemographicMap : ClassMapping<CustomerDemographic>
    {
        public CustomerDemographicMap()
        {
            Table("CustomerDemographics");
            Id(x => x.CustomerTypeID, map => { map.Generator(Generators.Assigned); map.Column("CustomerTypeID"); });
            Property(x => x.CustomerDesc, map => { map.Column("CustomerDesc"); map.Length(1073741823); });
            Bag(x => x.CustomerCustomerDemos, map => { map.Inverse(true); map.Key(key => key.Column("CustomerTypeID")); }, rel => rel.OneToMany());
        }
    }
}
